using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityUtilities;

public class SlowBuff : Buff
{
   
    private Countdown Duration;
    //减速量
    public float movement = -5;
    private float initSpeed;
    // Start is called before the first frame update
    private void Awake()
    {
        Duration = new Countdown(false, base.duration/1000.0f);
    }
    void Start()
    {
        initSpeed = gameObject.GetComponentInParent<state>().runSpeed;
        gameObject.GetComponentInParent<state>().setRunSpeed(initSpeed + movement);

    }

    // Update is called once per frame
    void Update()
    {
        if (Duration.Progress())
        {
            gameObject.GetComponentInParent<state>().setRunSpeed(initSpeed);
            Destroy(this.gameObject);
        }
    }
}
